#include "BuffEffectLogicManager.h"

BuffLogicManager::BuffLogicManager()
{

}

BuffLogicManager::~BuffLogicManager()
{

}

bool BuffLogicManager::Init()
{
	REGISTER_LOGIC(0,BuffLogic_000_None);
	REGISTER_LOGIC(1,BuffLogic_001_DisperseMark);
	REGISTER_LOGIC(2,BuffLogic_002_ImmuneMark);
	REGISTER_LOGIC(3,BuffLogic_003_ContinuanceDamage);
	REGISTER_LOGIC(4,BuffLogic_004_Dizzy);
	REGISTER_LOGIC(5,BuffLogic_005_Frozen);
	REGISTER_LOGIC(6,BuffLogic_006_Winding);
	REGISTER_LOGIC(7,BuffLogic_007_HpShield);
	REGISTER_LOGIC(8,BuffLogic_008_TargetMove);
	REGISTER_LOGIC(9,BuffLogic_009_Invisible);
	REGISTER_LOGIC(10,BuffLogic_010_RefixSkill);
	REGISTER_LOGIC(11,BuffLogic_011_Flash);
	REGISTER_LOGIC(12,BuffLogic_012_HaloDamage);
	REGISTER_LOGIC(13,BuffLogic_013_HaloBeat);
	REGISTER_LOGIC(14,BuffLogic_014_SummonCreature);
	REGISTER_LOGIC(15,BuffLogic_015_HaloDamageSquare);
	REGISTER_LOGIC(16,BuffLogic_016_DisperseBuffBagId);
	REGISTER_LOGIC(17,BuffLogic_017_ImmuneBuffBagId);
	REGISTER_LOGIC(18,BuffLogic_018_OneHitKill);
	REGISTER_LOGIC(19,BuffLogic_019_ReduceSkillCd);
	REGISTER_LOGIC(20,BuffLogic_020_SeeInVisible);
	REGISTER_LOGIC(21,BuffLogic_021_AddHpOneTime);
	REGISTER_LOGIC(22,BuffLogic_022_DelHpOneTime);
	REGISTER_LOGIC(23,BuffLogic_023_Drag);
	REGISTER_LOGIC(24,BuffLogic_024_ExchangeHp);
	REGISTER_LOGIC(25,BuffLogic_025_NoSee);
	REGISTER_LOGIC(27,BuffLogic_027_MaBi);

	REGISTER_LOGIC(28,BuffLogic_028_AddGoldPercentForever);
	REGISTER_LOGIC(30,BuffLogic_030_AddDropPercentForever);
	REGISTER_LOGIC(31,BuffLogic_031_ZiBao);
	REGISTER_LOGIC(32,BuffLogic_032_WuDi);

	REGISTER_LOGIC(34,BuffLogic_034_AddGoldPercent);
	REGISTER_LOGIC(35,BuffLogic_035_AddDropPercent);
	REGISTER_LOGIC(36,BuffLogic_036_AddBuffBag);
	REGISTER_LOGIC(37,BuffLogic_037_FullStatusReLive);
	REGISTER_LOGIC(38,BuffLogic_038_NoUseSkill);
	REGISTER_LOGIC(39,BuffLogic_039_HpShieldBomb);
	REGISTER_LOGIC(40,BuffLogic_040_FullHpMp);
	REGISTER_LOGIC(41,BuffLogic_041_MagicTriggerSkill);
	REGISTER_LOGIC(43,BuffLogic_043_AddHp);
	REGISTER_LOGIC(44,BuffLogic_44_ChangeBody);
	REGISTER_LOGIC(45,BuffLogic_45_ChangeAttr);
	REGISTER_LOGIC(47,BuffLogic_47_ChangeAttrPercent);
	REGISTER_LOGIC(48,BuffLogic_048_ReplaceSkill);
	REGISTER_LOGIC(49,BuffLogic_049_CircleHaleEffect);
	REGISTER_LOGIC(50,BuffLogic_050_RectHaleEffect);
	REGISTER_LOGIC(51,BuffLogic_051_ChaoFeng);
	REGISTER_LOGIC(52,BuffLogic_052_AddHate);
	REGISTER_LOGIC(53,BuffLogic_053_XiXue);
	REGISTER_LOGIC(54,BuffLogic_054_ZiBao);
	REGISTER_LOGIC(55,BuffLogic_055_FangYing);
	REGISTER_LOGIC(56,BuffLogic_056_XiMo);
	REGISTER_LOGIC(57,BuffLogic_057_FangShang);
	REGISTER_LOGIC(58,BuffLogic_058_BOSSSheild);
	REGISTER_LOGIC(59,BuffLogic_059_FangShang);
	REGISTER_LOGIC(60,BuffLogic_060_FengDan);

	REGISTER_LOGIC(101,BuffLogic_101_ChangeAP);
	REGISTER_LOGIC(102,BuffLogic_102_ChangeAPPercent);
	REGISTER_LOGIC(103,BuffLogic_103_ChangeMAT);
	REGISTER_LOGIC(104,BuffLogic_104_ChangeMatPercent);
	REGISTER_LOGIC(105,BuffLogic_105_ChangeDP);
	REGISTER_LOGIC(106,BuffLogic_106_ChangeDPPercent);
	REGISTER_LOGIC(107,BuffLogic_107_ChangeMDP);
	REGISTER_LOGIC(108,BuffLogic_108_ChangeMDPPercent);
	REGISTER_LOGIC(109,BuffLogic_109_ChangeMaxHp);
	REGISTER_LOGIC(110,BuffLogic_110_ChangeMaxHpPercent);
	REGISTER_LOGIC(111,BuffLogic_111_ChangeMaxMp);
	REGISTER_LOGIC(112,BuffLogic_112_ChangeMaxMPPercent);
	REGISTER_LOGIC(113,BuffLogic_113_ADDHP);
	REGISTER_LOGIC(114,BuffLogic_114_ADDMP);
	REGISTER_LOGIC(115,BuffLogic_115_ChangeHIT);
	REGISTER_LOGIC(116,BuffLogic_116_ChangeDodge);
	REGISTER_LOGIC(117,BuffLogic_117_ChangeCrit);
	REGISTER_LOGIC(118,BuffLogic_118_ChangeToughNess);
	REGISTER_LOGIC(119,BuffLogic_119_ChangeMovePercent);
	REGISTER_LOGIC(120,BuffLogic_120_ChangeAttackPercent);
	REGISTER_LOGIC(121,BuffLogic_121_ChangeCollectPercent);
	REGISTER_LOGIC(122,BuffLogic_122_ChangeExtraDamage);
	REGISTER_LOGIC(123,BuffLogic_123_ChangeReduceDamage);
	REGISTER_LOGIC(124,BuffLogic_124_ChangeCollectCreatureRate);
	REGISTER_LOGIC(125,BuffLogic_125_ChangeCollectDouble);
	REGISTER_LOGIC(128,BuffLogic_128_DisMount);
	return true;
}

bool BuffLogicManager::UnInit()
{
	for (auto it = m_buffLogic.begin(); it != m_buffLogic.end(); it++)
	{
		delete it->second;
		it->second = nullptr;
	}
	m_buffLogic.clear();
	return true;
}

void BuffLogicManager::Register(int32_t id, IBuffLogic* pLogic)
{
	if (pLogic == nullptr)
	{
		return;
	}
	m_buffLogic[id] = pLogic;
}

IBuffLogic* BuffLogicManager::GetBuffLogic(int logicId)
{
	auto it = m_buffLogic.find(logicId);
	if (it != m_buffLogic.end())
	{
		return it->second;
	}
	return nullptr;
}
